﻿// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.QueryStoreStatusRequest
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 8E14765A-6610-409A-BA36-099A0642905D
// Assembly location: E:\git\ALLIDA\windll\infocard.exe

using System;
using System.IO;

namespace Microsoft.InfoCards
{
  internal class QueryStoreStatusRequest : UIAgentRequest
  {
    private bool m_storeStatus;

    public QueryStoreStatusRequest(
      IntPtr rpcHandle,
      Stream inArgs,
      Stream outArgs,
      ClientUIRequest parent)
      : base(rpcHandle, inArgs, outArgs, parent)
    {
      this.OnInitializeAsSystem();
    }

    protected override void OnMarshalInArgs()
    {
    }

    protected override void OnProcess()
    {
      StoreConnection connection = StoreConnection.GetConnection();
      try
      {
        this.m_storeStatus = connection.IsDataSourceCleared(connection.LocalDataSource);
        if (!this.m_storeStatus)
          return;
        connection.ResetDataSourceClearedFlag(connection.LocalDataSource);
      }
      finally
      {
        connection.Close();
      }
    }

    protected override void OnMarshalOutArgs()
    {
      new BinaryWriter(this.OutArgs).Write(this.m_storeStatus);
    }
  }
}
